package cn.mygweb;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import tk.mybatis.spring.annotation.MapperScan;

/** 
* <p>Title: GwebApplication.java</p>
* <p>Description: 项目启动的入口程序</p>  
* @author gxb 
* @date 2019年5月18日  
*/ 
@SpringBootApplication
// 扫描mybatis mapper包路径
@MapperScan(basePackages= {"cn.mygweb.web.mapper","cn.mygweb.admin.modules.*.mapper","cn.mygweb.common.mapper"})	
// 扫描 所有需要的包, 包含一些自用的工具类包 所在的路径
@ComponentScan(basePackages= {"cn.mygweb","org.n3r.idworker"})
// 开启定时任务
@EnableScheduling
// 开启异步调用方法
@EnableAsync
public class GwebApplication extends SpringBootServletInitializer{

	/**
	 * <p>Title: configure</p>
	 * <p>Description: 支持war方式启动</p>
	 * @param builder
	 * @return
	 * @see org.springframework.boot.web.servlet.support.SpringBootServletInitializer#configure(org.springframework.boot.builder.SpringApplicationBuilder)
	 */
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(GwebApplication.class);
	}
	
	/**
	 * <p>Title: main</p>
	 * <p>Description: 支持jar方式启动</p>
	 * @param args
	 */
	public static void main(String[] args) {
		SpringApplication.run(GwebApplication.class, args);
	}

}
